<div class="formclass">

<?php $form=$this->beginWidget('CActiveForm', array('id'=>'post-form',
                'enableAjaxValidation'=>true,
                        'htmlOptions'=>array('enctype'=>'multipart/form-data'),
        )); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo CHtml::errorSummary($model); ?>

        <div class="row">
		<?php echo $form->labelEx($model,'filename'); ?>
		<?php echo CHtml::activeFileField($model, 'image'); ?>
		<?php //echo $form->error($model,'filename'); ?>
	</div>
	
	<!--<div class="row">
		<?php echo $form->labelEx($model,'category_id'); ?>
		<?php echo $form->dropDownList($model, 'category_id', Category::allCategories(), array('empty'=>'Select category')); ?>
		<?php echo $form->error($model,'category_id'); ?>
	</div>-->
        
        <?php echo $this->renderPartial('//common/categoryByLevel', array('form'=>$form, 'model'=>$model, 'fieldName'=>'category_id'));?>
        
        <div class="row">
		<?php echo $form->labelEx($model,'isNews'); ?>
		<?php echo $form->checkBox($model,'isNews'); ?>
	</div>
        
        <?php echo $this->renderPartial('tabs', array('form'=>$form, 'model'=>$model));?>
        
        <!--
        <div class="row">
		<?php echo $form->labelEx($model,'title'); ?>
		<?php echo $form->textField($model,'title',array('size'=>80,'maxlength'=>128)); ?>
		<?php echo $form->error($model,'title'); ?>
	</div>
	
	<div class="row">
		<?php echo $form->labelEx($model,'content'); ?>
		<?php //echo CHtml::activeTextArea($model,'content',array('rows'=>10, 'cols'=>70)); ?>
		<?php
			Yii::import('ext.krichtexteditor.KRichTextEditor');
			$this->widget('KRichTextEditor', array(
				'model' => $model,
				'value' => $model->isNewRecord ? $model->content : '',
				'attribute' => 'content',
				'options' => array(
					'theme_advanced_resizing' => 'true',
					'theme_advanced_statusbar_location' => 'bottom',
				),
			));?>
		<?php echo $form->error($model,'content'); ?>
	</div>
        -->
	<!--
	<div class="row">
		<?php echo $form->labelEx($model,'tags'); ?>
		<?php $this->widget('CAutoComplete', array(
			'model'=>$model,
			'attribute'=>'tags',
			'url'=>array('suggestTags'),
			'multiple'=>true,
			'htmlOptions'=>array('size'=>50),
		)); ?>
		<p class="hint">Please separate different tags with commas.</p>
		<?php echo $form->error($model,'tags'); ?>
	</div>
	-->
	<div class="row">
		<?php echo $form->labelEx($model,'status'); ?>
		<?php echo $form->dropDownList($model,'status',Lookup::items('PostStatus')); ?>
		<?php echo $form->error($model,'status'); ?>
	</div>

	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->